package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) throws InterruptedException {
        SpringApplication.run(DemoApplication.class, args);
        createTask();
    }


    public static void createTask() throws InterruptedException {

        DelayQueueTask task = SpringBeanUtil.getBean(DelayQueueTask.class);
        Thread.sleep(1000l);
        System.out.println("等待一秒侯放入任务1");
        task.createTask(1647751548000L,"任务1 应该30分执行");
        Thread.sleep(1000l);
        System.out.println("等待一秒侯放入任务2");
        task.createTask(1647751428000l,"任务2 28分执行");
//        Thread.sleep(1000l);
//        System.out.println("等待一秒侯放入任务3");
//        task.createTask(2000l,"任务3");
//        Thread.sleep(1000l);
//        System.out.println("等待一秒侯放入任务4");
//        task.createTask(3000l,"任务4");
//        Thread.sleep(1000l);
//        System.out.println("等待一秒侯放入任务5");
//        task.createTask(4000l,"任务5");
    }
}
